home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / TIMING.SWG / 0026_WAIT any number of seconds.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  2KB  |  87 lines

  1. {
  2. Here is a copy of a little program I wrote called WAIT.PAS. It will wait
  3. for however number of seconds you wish. Good for BBS batch files & what
  4. not.
  5. }
  6.   program wait; uses dos, crt;
  7.  
  8.   var out1,out,time1,time2,time3,date1,date2,date3:string[50];
  9.  
  10.    procedure timedate;
  11.    var
  12.      ax1,ax2,ax3,ax4:word;
  13.      year,month,mil,day,dayofweek,hour,minute,second:string[20];
  14.    begin
  15.      time1:=''; { 22:00:00 }
  16.      date1:=''; { 03/03/88 }
  17.      time2:=''; { 02:03am  }
  18.      date2:=''; { wednesday, january 25th, 1988 }
  19.      gettime(ax1,{ hour } ax2,{ minute } ax3, { second }ax4);
  20.      str(ax1,hour); str(ax2,minute); str(ax3,second);
  21.      if length(minute)=1 then insert('0',minute,1);
  22.      if length(second)=1 then insert('0',second,1);
  23.      if length(hour)=1 then insert('0',hour,1);
  24.      time1:=hour+':'+minute+':'+second;
  25.      getdate(ax1, { year  }ax2, { month }ax3, { day }ax4);{ day of week }
  26.      str(ax3,day); if length(day)=1 then insert('0',day,1);
  27.      str(ax1,year); str(ax2,month);
  28.      if length(month)=1 then insert('0',month,1);
  29.      date1:=month+'-'+day+'-'+copy(year,3,2);
  30.    end;
  31.  
  32.   procedure pause(secs:integer);
  33.   var
  34.     zit:boolean; zeek:string[15]; x9,y1:integer;
  35.   begin
  36.     textcolor(12);
  37.     x9:=0;
  38.     zit:=false;
  39.     timedate;
  40.     zeek:=time1;
  41.     while not zit do
  42.       begin
  43.         timedate;
  44.         if zeek<>time1 then
  45.           begin
  46.             zeek:=time1;
  47.             x9:=x9+1;
  48.             str(x9,out1);
  49.             write(x9);
  50.             for y1:=1 to length(out1) do write('');
  51.           end;
  52.         if keypressed then
  53.           begin
  54.             writeln;
  55.             writeln;
  56.             textcolor(3);
  57.             writeln('Aborted!');
  58.             halt;
  59.           end;
  60.         if x9>=secs then zit:=true;
  61.       end;
  62.   end;
  63.  
  64.   var
  65.     code,xint:integer;
  66.   begin
  67.     writeln;
  68.     textcolor(15);
  69.     writeln('WAIT v1.2 - a batch file wait program.');
  70.     textcolor(11);
  71.     writeln;
  72.     if paramstr(1)='' then
  73.       begin
  74.         write('Usage: wait <seconds> (example: "wait 2" for ');
  75.         writeln('a 2 second delay.');
  76.         halt;
  77.       end;
  78.     xint:=0;
  79.     out:=paramstr(1);
  80.     val(out,xint,code);
  81.     write('Waiting ',xint,' seconds... (',xint div 60,' min.) --> ');
  82.     pause(xint);
  83.     writeln;
  84.     textcolor(3);
  85.     writeln('Done!');
  86.   end.
  87.